<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class CabinetPoint extends Model
{
    const  WRITABLE_NO = 0;
    const  WRITABLE_SWITCH = 1;
    const  WRITABLE_PARAM = 2;
    const  WRITABLE_TEXT = ['0' => '否', '1' => '开关', '2' => '参数'];

    protected $table = 'xfy_cabinet_points';
    protected $primaryKey = 'id';

    protected $fillable = ['cabinet_id', 'name', 'alias', 'realtime_show', 'history_show', 'history_line_show', 'units', 'decimal', 'writable'];

    public function devices()
    {
        return $this->belongsTo(Cabinet::class, 'cabinet_id');
    } 
}